package java_14;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

/*
baidu RandomAcessFile的用法，给出案例
*/
public class Test_9 {
    public static void main(String[] args) throws IOException {
        String str="D:\\第一小组\\q.txt";
        RandomAccessFile r=null;
        File f=null;
        try {
            f=new File(str);
            r=new RandomAccessFile(f,"q");
           r.seek(1000);
           byte[]b=new byte[1024];
           int hasRead=0;
           while ((hasRead=r.read(b))>0){
               System.out.println(new String(b,0,hasRead));
           }
        } catch (Exception e) {
            e.printStackTrace();

        }finally {
            r.close();
        }
    }
}
